﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>系统控制台</title>
<meta name="keywords" content="系统控制台" />
<meta name="description" content="系统控制台" />
<meta name="author" content="chichi" />
<meta name="reply-to" content="qqhil@163.com" />
<meta name="copyright" content="" />
<style type="text/css">
<!--
* {
	margin: 0px;
	padding: 0px;
}
body {
	background-color: #FFFFFF;
	color: #000000;
	margin: 0px;
	font-family: "\5fae\8f6f\96c5\9ed1", tahoma, arial, sans-serif;
}
input {
	text-align: center;
	width: 200px;
	height: 20px;
	padding: 5px;
}
a:link {
	color: green;
	text-decoration: none;
}
a:visited {
	color: green;
	text-decoration: none;
}
a:active {
	color: green;
	text-decoration: none;
}
a:hover {
	color: #ed776b;
	text-decoration: none;
}
table {
	border-collapse: collapse;
	margin: 10px 0px;
	clear: both;
}
.inp tr th, td {
	padding: 2px 5px 2px 5px;
	vertical-align: center;
	text-align: center;
	height: 30px;
	border: 1px #FFFFFF solid;
}
.head1 {
	background-color: #2c3e50;
	width: 100%;
	font-size: 36px;
	color: #ffffff;
	padding-top: 10px;
	text-align: center;
	font-family: Georgia, "Times New Roman", Times, serif;
	font-weight: bold;
}
.head2 {
	background-color: #58AEF4;
	width: 100%;
	font-size: 18px;
	height: 18px;
	color: #ffffff;
}
.el {
	text-align: center;
	background-color: #d3e1e5;
}
.er {
	text-align: right;
	background-color: #d3e1e5;
}
.ec {
	text-align: center;
	background-color: #58AEF4;
	font-weight: bold;
	color: #FFFFFF;
}
.fl {
	text-align: left;
	background-color: #ecf0f1;
	color: #505050;
}
.fr {
	text-align: right;
	background-color: #eeeeee;
	color: #505050;
}
.fc {
	text-align: center;
	background-color: #ecf0f1;
	color: #505050;
}
.ft {
	text-align: center;
	background-color: #D9F9DE;
	color: #060;
}
a.arrow {
	font-family: webdings, sans-serif;
	font-size: 10px;
}
a.arrow:hover {
	color: #ff0000;
	text-decoration: none;
}
-->
</style>
<script language="javascript" type="text/javascript">
function ajax(options) {
	options = options || {};
	options.type = (options.type || "GET").toUpperCase();
	options.dataType = options.dataType || "json";
	var params = formatParams(options.data);

	//创建 - 非IE6 - 第一步
	if (window.XMLHttpRequest) {
		var xhr = new XMLHttpRequest();
	} else { //IE6及其以下版本浏览器
		var xhr = new ActiveXObject('Microsoft.XMLHTTP');
	}

	//接收 - 第三步
	xhr.onreadystatechange = function () {
		if (xhr.readyState == 4) {
			var status = xhr.status;
			if (status >= 200 && status < 300) {
				options.success && options.success(xhr.responseText, xhr.responseXML);
			} else {
				options.fail && options.fail(status);
			}
		}
	}

	//连接 和 发送 - 第二步
	if (options.type == "GET") {
		xhr.open("GET", options.url + "?" + params, true);
		xhr.send(null);
	} else if (options.type == "POST") {
		xhr.open("POST", options.url, true);
		//设置表单提交时的内容类型
		xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xhr.send(params);
	}
}

//格式化参数
function formatParams(data) {
	var arr = [];
	for (var name in data) {
		arr.push(encodeURIComponent(name) + "=" + encodeURIComponent(data[name]));
	}
	arr.push(("v=" + Math.random()).replace(".",""));
	return arr.join("&");
}	

function getInfo(){
	var hostUrl = window.location.protocol + '//' + window.location.host ;
    ajax({
        url: hostUrl + '/get_info.jsp',//请求地址
        type: "POST", //请求方式
        data: { name: "super", age: 20 },//请求参数
        dataType: "json",
        success: function (response, xml) {
			var result = response.split("|");
			if (result != null && result.length == 10){
				document.getElementById('currConnections').innerText = result[0];
                document.getElementById('currDevices').innerText = result[1];
				document.getElementById('currTime').innerText = result[2];
				document.getElementById('maxMemory').innerText = result[3];
				document.getElementById('freeMemory').innerText = result[4];
				document.getElementById('useMemory').innerText = result[5];
				document.getElementById('threadCount').innerText = result[6];
                document.getElementById('lastSendTime').innerText = result[7];
                document.getElementById('sendQueueSize').innerText = result[8];
                document.getElementById('receiveQueueSize').innerText = result[9];
			}else{
				window.location.href = hostUrl + '/login.jsp';
			}
        },
        fail: function (status) {
			window.location.href = hostUrl + '/login.jsp';
        }
    });
}

var i = null;
var isRefresh=true;
function refreshInfo(){
	if (isRefresh){
		document.getElementById('refreshBtn').value = "关闭自动刷新";
		if (i!= null){
			clearInterval(i);
		}
		i = setInterval('getInfo()',document.getElementById('refreshTime').value * 1000);
		document.getElementById('refreshTime').disabled = true;
		isRefresh= false;
	}else{
		document.getElementById('refreshBtn').value = "开启自动刷新";
		if (i!= null){
			clearInterval(i);
		}
		document.getElementById('refreshTime').disabled = false;
		isRefresh= true;
	}
}

</script>
</head>
<body>
<div class="head1">系统控制台</div>
<div class="head2"></div>
<div style="margin:0 auto;width:1001px;overflow:hidden;">
  <table width="100%" class="inp">
    <tr>
      <th colspan="2" class="ec" width="50%">服务器信息</th>
      <th colspan="2" class="ec" width="50%">参数设置</th>
    </tr>
    <tr>
      <td class="er" width="20%">系统启动时间</td>
      <td class="fl" width="30%">{START_TIME}</td>
      <td class="er" width="20%">监听端口</td>
      <td class="fc" width="30%"><span style="color: #008000; font-weight : bold;">{PORT}</span></td>
    </tr>
    <tr>
      <td class="er">服务器时间</td>
      <td class="fl" id="currTime">{SERVER_TIME}</td>
      <td class="er">读超时</td>
      <td class="fc"><span style="color: #008000; font-weight : bold;">{READ_IDLE_TIME}秒</span></td>
    </tr>
    <tr>
      <td class="er">当前连接数</td>
      <td class="fl" id="currConnections">{CURR_CONNECTIONS}</td>
      <td class="er">写超时</td>
      <td class="fc"><span style="color: #008000; font-weight : bold;">{WRITE_IDLE_TIME}秒</span></td>
    </tr>
    <tr>
      <td class="er">当前设备数</td>
      <td class="fl" id="currDevices">{CURR_DEVICES}</td>
      <td class="er">读写超时</td>
      <td class="fc"><span style="color: #008000; font-weight : bold;">{ALL_IDLE_TIME}秒</span></td>
    </tr>
    <tr>
      <td class="er">最后指令下发时间</td>
      <td class="fl" id="lastSendTime">{LAST_SEND_TIME}</td>
      <td class="er"></td>
      <td class="fc"><span style="color: #008000; font-weight : bold;"></span></td>
    </tr>
    <tr>
      <td class="er">发送队列长度</td>
      <td class="fl" id="sendQueueSize">{SEND_QUEUE_SIZE}</td>
      <td class="er"></td>
      <td class="fc"><span style="color: #008000; font-weight : bold;"></span></td>
    </tr>
    <tr>
      <td class="er">接收队列长度</td>
      <td class="fl" id="receiveQueueSize">{RECEIVE_QUEUE_SIZE}</td>
      <td class="er"></td>
      <td class="fc"><span style="color: #008000; font-weight : bold;"></span></td>
    </tr>
    <tr>
      <td class="er">最大可用内存</td>
      <td class="fl" id="maxMemory">{MAX_MEMORY}</td>
      <td class="er">指令地址</td>
      <td class="fc"><span style="color: #008000; font-weight : bold;">{CONTROL_URL}</span></td>
    </tr>
    <tr>
      <td class="er">剩余内存</td>
      <td class="fl" id="freeMemory">{FREE_MEMORY}</td>
      <td class="er">客户端连接超时</td>
      <td class="fc"><span style="color: #008000; font-weight : bold;">{CONNECT_TIME_OUT}毫秒</span></td>
    </tr>
    <tr>
      <td class="er">已使用内存</td>
      <td class="fl" id="useMemory">{USE_MEMORY}</td>
      <td class="er">最大待读取数据长度</td>
      <td class="fc"><span style="color: #008000; font-weight : bold;">{MAX_READABLE_BYTES_LENGTH}字节</span></td>
    </tr>
    <tr>
      <td class="er">当前线程数</td>
      <td class="fl" id="threadCount">{THREAD_COUNT}</td>
      <td class="er">访问控制台IP限制</td>
      <td class="fc"><span style="color: #008000; font-weight : bold;">{SOURCE_IP}</span></td>
    </tr>
    <tr>
      <td class="er"></td>
      <td class="fl"><span style='color:green'></span></td>
      <td class="er"></td>
      <td class="fc"><span style="color: #008000; font-weight : bold;"></span></td>
    </tr>
  </table>
  <!--<table width="100%" class="inp">
    <tr>
      <td colspan="3" class="ec" width="50%">PHP Zend解密组件</td>
      <td colspan="3" class="ec" width="50%">PHP 缓存优化组件</td>
    </tr>
    <tr>
      <td class="el">Zend Optimizer</td>
      <td class="el">Zend GuardLoader</td>
      <td class="el">ionCubeLoader</td>
      <td class="el">WinCache</td>
      <td class="el">Zend OPcache</td>
      <td class="el">Memcache</td>
    </tr>
    <tr>
      <td class="fc"><span style="color: #e74c3c; font-weight : bold;">未开启</span></td>
      <td class="fc"><span style="color: #008000; font-weight : bold;">已开启</span></td>
      <td class="fc"><span style="color: #e74c3c; font-weight : bold;">未开启</span></td>
      <td class="fc"><span style="color: #008000; font-weight : bold;">已开启</span></td>
      <td class="fc"><span style="color: #e74c3c; font-weight : bold;">未开启</span></td>
      <td class="fc"><span style="color: #008000; font-weight : bold;">已开启</span></td>
    </tr>
    <tr>
      <td colspan="6" class="ft">cgi-fcgi PHP/5.3.29-upupw不完全包括以上组件,不同PHP版本能适配的外部扩展不同,为了性能以上组件除网站特别要求外没必要全开启!</td>
    </tr>
  </table>
  <table width="100%" class="inp">
    <tr>
      <td colspan="6" class="ec" width="100%">PHP重要参数检测</td>
    </tr>
    <tr>
      <td class="el">Memory限制</td>
      <td class="el">Upload限制</td>
      <td class="el">POST限制</td>
      <td class="el">Execution超时</td>
      <td class="el">Input超时</td>
      <td class="el">Socket超时</td>
    </tr>
    <tr>
      <td class="fc">256M</td>
      <td class="fc">300M</td>
      <td class="fc">300M</td>
      <td class="fc">300s</td>
      <td class="fc">60s</td>
      <td class="fc">120s</td>
    </tr>
  </table>
  <table width="100%" class="inp">
    <tr>
      <th class="ec">PHP已编译模块检测</th>
    </tr>
    <tr>
      <td class="fl" style="text-align:center;"> Core&nbsp;&nbsp;&nbsp;&nbsp;bcmath&nbsp;&nbsp;&nbsp;&nbsp;calendar&nbsp;&nbsp;&nbsp;&nbsp;ctype&nbsp;&nbsp;&nbsp;&nbsp;date&nbsp;&nbsp;&nbsp;&nbsp;ereg&nbsp;&nbsp;&nbsp;&nbsp;filter&nbsp;&nbsp;&nbsp;&nbsp;ftp&nbsp;&nbsp;&nbsp;&nbsp;hash&nbsp;&nbsp;&nbsp;&nbsp;iconv&nbsp;&nbsp;&nbsp;&nbsp;json&nbsp;&nbsp;&nbsp;&nbsp;mcrypt&nbsp;&nbsp;&nbsp;&nbsp;SPL&nbsp;&nbsp;&nbsp;&nbsp;<br />
        odbc&nbs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bsp;&nbsp;memcache&nbsp;&nbsp;&nbsp;&nbsp;wincache&nbsp;&nbsp;&nbsp;&nbsp;<br />
        mhash&nbsp;&nbsp;&nbsp;&nbsp;Zend Guard Loader&nbsp;&nbsp;&nbsp;&nbsp;</td>
    </tr>
  </table>-->
  <form method="post" action="/u.php">
    <table width="100%" class="inp">
      <tr>
        <th colspan="4" class="ec">操作服务器</th>
      </tr>
      <tr>
        <td width="20%" class="er">刷新时间</td>
        <td width="30%" class="fl"><input type="text" name="refreshTime" id="refreshTime" value="3" /></td>
        <td width="20%" class="er">操作密码</td>
        <td width="30%" class="fl"><input type="text" name="password" value="" /></td>
      </tr>
      <tr>
        <td colspan="4" class="ft">
          <input type="button" value="开启自动刷新" name="refreshBtn" id="refreshBtn" style="height:30px; width: 100px; margin: 10px;"  onClick="refreshInfo();"/>
          <input type="button" value="关闭程序" name="close" style="height:30px; width: 100px; margin: 10px;" />
        </td>
      </tr>
      <!--      <tr>
        <td class="er">数据库用户名</td>
        <td class="fl"><input type="text" name="mysqlUser" value="" /></td>
        <td class="er">数据库用户密码</td>
        <td class="fl"><input type="text" name="mysqlPassword" /></td>
      </tr>
      <tr>
        <td colspan="4" align="center"><input type="submit" value=" 连 接 " name="act" style="height:30px;" /></td>
      </tr>-->
    </table>
  </form>
  <p style="color:#33384e;font-size:14px;text-align:center; margin-bottom:2px;">服务器控制台&nbsp;&nbsp;&nbsp;页面执行时间 0.000000 秒&nbsp;&nbsp;&nbsp;消耗内存 0.32MB</p>
  <hr style="width:100%; color:#cdcdcd" noshade="noshade" size="1" />
  <p style="color:#505050; font-size:14px; text-align:center;">&copy;2016 <a href="#">服务器控制台</a> 版权所有</p>
</div>
</body>
</html>
